home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / bcsrce2.zip / CHEKBOX.BC < prev    next >
Text File  |  1990-10-15  |  3KB  |  123 lines

  1. ansi
  2. let %!a = %1
  3. if %!a# = # goto ERROR
  4. let %!z = %!a
  5. gt %!z 21
  6. if errorlevel 1 goto ERROR
  7. if %!a = 0 Let %!a = 10
  8. goto TEST1
  9. :TEST1
  10. let %!b = %2
  11. if %!b# = # goto ERROR
  12. let %!z = %!b
  13. gt %!z 65
  14. if errorlevel 1 goto ERROR
  15. if %!b = 0 Let %!b = 30
  16. erase yes.yes > nul
  17. erase no.no > nul
  18. let %!p = %3
  19. if %!p# = # let %!p = y
  20. lower %!p
  21. if %!p = yes let %!p = y
  22. if %!p = y let %!e = 1
  23. if %!p = no let %!p = n
  24. if %!p = n let %!e = 1
  25. if not %!e@ = 1@ goto ERROR
  26. if %!p = y GOSUB YES
  27. if %!p = n GOSUB NO
  28. goto CHOOSE
  29. :YES
  30. locate %!a %!b
  31. echonolf ╔═════╗   ┌─────┐
  32. let %!s = %!a
  33. add %!s 1
  34. locate %!s %!b
  35. echonolf ║ Yes ║   │ No! │
  36. add %!s 1
  37. locate %!s %!b
  38. echonolf ╚═════╝   └─────┘
  39. return
  40. :NO
  41. locate %!a %!b
  42. echonolf ┌─────┐   ╔═════╗
  43. let %!s = %!a
  44. add %!s 1
  45. locate %!s %!b
  46. echonolf │ Yes │   ║ No! ║
  47. add %!s 1
  48. locate %!s %!b
  49. echonolf └─────┘   ╚═════╝
  50. return
  51. :CHOOSE
  52. rem 3840=Shift tab, 121=y, 110=n, 89=Y, 78=N, 27=Esc, 13=Enter, 9=Tab
  53. rem Left arrow=19200, Right arrow=19712
  54. getkey
  55. if errlevel 19712 GOTO ARROW
  56. if errlevel 19200 GOTO ARROW
  57. if errlevel 3840 GOTO ARROW
  58. if errlevel 121 GOTO MAKEYES
  59. if errlevel 110 GOTO MAKENO
  60. if errlevel 89 GOTO MAKEYES
  61. if errlevel 78 GOTO MAKENO
  62. if errlevel 27 GOTO END
  63. if errlevel 13 GOTO ENTER
  64. if errlevel 9 GOTO ARROW
  65. goto CHOOSE
  66. :ARROW
  67. if %!p = y GOTO YES_NO
  68. if %!p = n GOTO NO_YES
  69. goto CHOOSE
  70. :YES_NO
  71. GOSUB NO
  72. let %!p = n
  73. goto CHOOSE
  74. :NO_YES
  75. GOSUB YES
  76. let %!p = y
  77. goto CHOOSE
  78. :ENTER
  79. if %!p = y GOTO MAKEYES
  80. if %!p = n GOTO MAKENO
  81. :MAKEYES
  82. GOSUB YES
  83. TYPE YES.YES > YES.YES
  84. GOTO END
  85. :MAKENO
  86. GOSUB NO
  87. TYPE NO.NO > NO.NO
  88. GOTO END
  89. :SYNTAX
  90. echo.
  91. echo       SYNTAX---:  CHEKBOX [ROW(1-21)] [COLUMN(1-65)] [yes]/[no]
  92. echo       USAGE----:  Use in .BAT programs to interreact with users. Program-
  93. echo                   mer positions a yes/no check box at given row/column
  94. echo                   coordinates. An option is provided to preselect either
  95. echo                   yes or no. The default is CHEKBOX 10 30 yes.
  96. echo                   You can choose the defaults by using CHEKBOX 0 0 so long
  97. echo                   as they are not out of alignment. In other words, yes or
  98. echo                   no MUST be the third parameter, parameter two cannot ex-
  99. echo                   ceed 65, and parameter one must be less than 22. User
  100. echo                   has these keypresses to choose from left/right cursor,
  101. echo                   tab, shift tab, Enter, ESCape, Y, y, N, and n.
  102. echo.
  103. echo       EXAMPLE--:  CHECKBOX 17 30 no
  104. echo       EXAMPLE--:  CHEKBOX 5 0  {column 30 and yes is defaulted to}
  105. echo       EXAMPLE--:  CHEKBOX 0 0  {row 10, column 30 and yes is defaulted to}
  106. echo                   Only the yes/no can be omitted.
  107. echo.
  108. echo     One of two zero byte files are created dependent upon user's choice.
  109. echo     If yes, YES.YES. If no, NO.NO. Use IF EXIST for the test.
  110. echo.
  111. echo       Public Domain BATCOM program example, 1990, by Felix A. Rozewicz
  112. goto END
  113. :ERROR
  114. echo  Unable to verify validity of first 2 primary parameters.
  115. echo  Or, there is an error in typing yes/no parameter.
  116. beep
  117. echo.
  118. waitkey 2
  119. goto SYNTAX
  120. :END
  121. EXIT
  122.  
  123.